export default {
    // 相当于vue的计算属性
    // powerCounter(state) {
    //     // 做平方
    //     return state.counter * state.counter;
    // },
    powerCounter(state) {
        // 做平方
        return state.counter * state.counter;
    },
    more18stu(state) {
        return state.students.filter(s => s.age >= 18)
    },
    more20stuLength(state, getters) {
        return getters.more18stu.length;
    },
    // moreAgeStu(state) {
    //     // return function (age) {
    //     //     return state.students.filter(s => s.age >= age);
    //     // }
    //     return age => state.students.filter(s => s.age >= age);
    // }
    moreAgeStu: state => age => state.students.filter(s => s.age >= age),
    // moreAgeStuLength(state) {
    //     // return function (age) {
    //     //     return state.students.filter(s => s.age >= age).length
    //     // }
    //     return age => state.students.filter(s => s.age >= age).length;
    // }
    moreAgeStuLength: state => age => state.students.filter(s => s.age >= age).length,
}